package plan.parser.classes;


public class Subject implements Comparable<Subject> {

	String name;
	int duration;
	int weekDay;
	Time time;
	String place;
	String type;

	public Time getTime() {
		return time;
	}

	public void setTime(Time time) {
		this.time = time;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getWeekDay() {
		return weekDay;
	}

	public void setWeekDay(int weekDay) {
		this.weekDay = weekDay;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	public String toString() {

		WeekDay dayOfTheWeek = WeekDay.getWeekDay(weekDay);
		return name + " " + type + " " + dayOfTheWeek.toString() + " "
				+ time.toString() + " " + duration;

	}

	@Override
	public int compareTo(Subject aThat) {
		final int EQUAL = 0;

		if (this == aThat)
			return EQUAL;

		int comparison = this.name.compareTo(aThat.name);
		if (comparison != EQUAL)
			return comparison;

		comparison = this.type.compareTo(aThat.type);
		if (comparison != EQUAL)
			return comparison;

		return EQUAL;

	}

	public long getTimeLong() {
		return (time.hour * 60 * 60 + time.minute * 60) * 1000;
	}

}
